//
// Created by hujin on 2020/11/8.
//

#ifndef C_MIPS_CMPLR_CODE_SYNTHESIS_H
#define C_MIPS_CMPLR_CODE_SYNTHESIS_H


#include <set>
#include <string>
#include <sstream>

class Synthesizer{
public:
    std::ostringstream data;
    std::ostringstream text;
    std::string genCode() const{
        std::string ret;
        ret.append(".data\n");
        ret.append(data.str());
        ret.append(".text\n");
        ret.append(text.str());
        return ret;
    }
    void multCnst(int regs, int regt, int cnst){
        if(regs != regt || cnst != 1) text<<"mul $"<<regt<<" $"<<regs<<" ,"<<cnst<<std::endl;
    }

    void concat(Synthesizer *another){
        text<<another->text.str();
        data<<another->data.str();
    }
};




#endif //C_MIPS_CMPLR_CODE_SYNTHESIS_H
